package com.xiaoyu.lanling.feature.guard.viewholder

import android.view.View
import androidx.fragment.app.FragmentActivity
import com.xiaoyu.base.app.App
import com.xiaoyu.base.data.UserData
import com.xiaoyu.base.utils.extensions.getViewTag
import com.xiaoyu.lanling.common.Constant
import com.xiaoyu.lanling.feature.guard.datamodel.MyGuardItem
import com.xiaoyu.lanling.feature.guard.fragment.GuardDetailDialogFragment

class MyGuardViewHolder : BaseGuardViewHolder<MyGuardItem>() {

    override val onClickListener: View.OnClickListener = View.OnClickListener {
        val guardItem = it.getViewTag<MyGuardItem>() ?: return@OnClickListener
        val activity = (App.getInstance().topActivity as? FragmentActivity)
                ?: return@OnClickListener
        GuardDetailDialogFragment.show(activity.supportFragmentManager, guardItem.user, UserData.getInstance().user, 0, Constant.From.GUARD_LIST)
    }
}